<template>
  <el-dialog title="广告编辑" :visible.sync="idDetail">
    <el-form :model="form">
      <el-form-item label="姓名" :label-width="formLabelWidth" required>
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="专业" :label-width="formLabelWidth" required>
        <el-input v-model="form.specialty" />
      </el-form-item>
      <el-form-item label="获奖类型" :label-width="formLabelWidth" required>
        <el-input :value="form.type" autocomplete="off" />
      </el-form-item>
      <el-form-item label="年份" :label-width="formLabelWidth" required>
        <el-input v-model="form.year" autocomplete="off" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="idDetail = false">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { studentEdit } from '@/api/student'
import { getToken } from '@/utils/auth'
export default {
  components: {},
  // eslint-disable-next-line vue/require-prop-types
  props: ['form', 'adverttype'],
  data() {
    return {
      idDetail: false,
      formLabelWidth: '15%',
      headerObj: {
        Authorization: 'Bearer ' + getToken(),
        Channel: 'PC'
      },
      dialogImageUrl: '',
      dialogVisible: false
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submit() {
      const val = {
        id: this.form.id,
        name: this.form.name,
        specialty: this.form.specialty,
        type: this.form.type,
        year: this.form.year
      }
      console.log('val', val)
      studentEdit(val)
        .then((res) => {
          if (res.code === 9999) {
            this.$message.success('编辑成功')
            this.$emit('sonSay')
            this.idDetail = false
          }
        })
        .catch(() => {
          this.$message.error('编辑失败')
        })
    }
  }
}
</script>
